package com.cy.pj.sys.controller;
import com.cy.pj.sys.pojo.JsonResult;
import com.cy.pj.sys.pojo.Sysinformation;
import com.cy.pj.sys.service.SysinformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/notice/")
public class sysinformationController {
    @Autowired
    private SysinformationService sysinformationService;

    @GetMapping("{id}")
    public JsonResult doFindById(@PathVariable Integer id){
        return new JsonResult(sysinformationService.findById(id));
    }
    @DeleteMapping("{id}")
    public JsonResult doDeleteById(@PathVariable  Integer id) {
        sysinformationService.deleteById(id);
        return new JsonResult("delete ok");
    }
    @PutMapping
    public JsonResult doUpdateNotice(@RequestBody Sysinformation information){
        sysinformationService.updateinformation(information);
        return new JsonResult("update ok");
    }
    @PostMapping
    public JsonResult doSaveNotice(@RequestBody Sysinformation information){
        sysinformationService.insertinformation(information);
        return new JsonResult("save ok");//json序列化(将对象转换为json格式字符串)
    }
}
